class CreatePermissions < ActiveRecord::Migration
  def self.up
    create_table :permissions do |t|
      t.string :action
      t.string :object_type
      t.integer :object_id

      t.timestamps
    end
    add_index :permissions, [:action, :object_type], :unique => true
    add_index :permissions, :action, :unique => false
  end

  def self.down
    remove_index :permissions, :column => [:action, :object_type]
    remove_index :permissions, :column => :action
    drop_table :permissions
  end
end
